package svc

import (
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"zg2_zy/zy6_company/api/internal/config"
	"zg2_zy/zy6_company/api/internal/middleware"
	"zg2_zy/zy6_company/companyRpc/companyclient"
)

type ServiceContext struct {
	Config     config.Config
	UserLogin  rest.Middleware
	CompanyRpc companyclient.Company
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:     c,
		UserLogin:  middleware.NewUserLoginMiddleware().Handle,
		CompanyRpc: companyclient.NewCompany(zrpc.MustNewClient(c.CompanyRpc)),
	}
}
